package com.jinyu.jyly.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jinyu.jyly.R;
import com.jinyu.jyly.bean.MineBuyOrderInfo;

import java.util.List;


/**
 *
 */
public class MinePageBuyTabAdapter extends BaseQuickAdapter<MineBuyOrderInfo.DataBean, BaseViewHolder> {

    public MinePageBuyTabAdapter(List<MineBuyOrderInfo.DataBean> data, int layoutResIds) {
        super(layoutResIds, data);
    }


    @Override
    protected void convert(final BaseViewHolder helper, final MineBuyOrderInfo.DataBean item) {
        helper.addOnClickListener(R.id.tv_go_pay);
        helper.addOnClickListener(R.id.tv_btn01);
        helper.addOnClickListener(R.id.tv_btn02);

        helper.setText(R.id.tv_order_num, item.getOrder_num());
        helper.setText(R.id.tv_order_stat, item.getCreate_time());
        helper.setText(R.id.tv_order_s, item.getName());
        helper.setText(R.id.tv_kuhao, item.getStock_num());
        helper.setText(R.id.tv_shifu_price, item.getPrice() + "");
        helper.setText(R.id.tv_price, item.getPrice() + "");
        TextView tv_go_pay = helper.getView(R.id.tv_go_pay);
        TextView tv_btn01 = helper.getView(R.id.tv_btn01);
        TextView tv_btn02 = helper.getView(R.id.tv_btn02);
        helper.setText(R.id.tv_sell_mobile, item.getSell_mobile());


        int status = item.getStatus();
        switch (status) {
            case 0:
                //待入场
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "待入场");
                break;
            case 1:
                //待被买
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "待被买");
                break;
            case 2:
                //已锁单
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                tv_go_pay.setVisibility(View.VISIBLE);
                tv_go_pay.setText("去付款");
                helper.setText(R.id.tv_order_state, "待付款");
                break;
            case 3:
                //已付款
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "已付款");
                break;
            case 4:
                //已确认收款
                helper.setText(R.id.tv_order_state, "已确认收款");
                tv_go_pay.setVisibility(View.VISIBLE);
                tv_go_pay.setText("转拍");
                tv_btn01.setVisibility(View.VISIBLE);
                tv_btn02.setVisibility(View.VISIBLE);

                break;
            case 5:
                //已完成
                helper.setText(R.id.tv_order_state, "已完成");
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                break;
            case 6:
                //已取消
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "已取消");
                break;
            case 7:
                //待发货
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "待发货");
                break;
            case 8:
                //待收货
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "待收货");
                tv_go_pay.setVisibility(View.VISIBLE);
                tv_go_pay.setText("确认收货");
                break;
            case 9:
                //已收货
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "已收货");
                break;
            case 10:
                //待分割
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "待分割");
                break;
            case 11:
                //已分割
                tv_go_pay.setVisibility(View.GONE);
                tv_btn01.setVisibility(View.GONE);
                tv_btn02.setVisibility(View.GONE);
                helper.setText(R.id.tv_order_state, "已分割");
                break;
        }

    }


}


